//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;

namespace Microsoft.Research.DataLayer
{
    public partial class ActivityACL
    {
        /// <summary>
        /// Creates a new ACL object for a new version of the activity.
        /// </summary>
        /// <param name="oldACL">ACL object from the old version.</param>
        /// <param name="newAct">New ACL object.</param>
        /// <param name="connection">The connection object.</param>
        /// <returns>ActivityACL object.</returns>
        public static ActivityACL CreateACLForNewVersion(ActivityACL oldACL, Activity newAct, Connection connection)
        {
            ActivityACL newObj = new ActivityACL(connection);
            newObj.ObjID = Guid.Empty;
            newObj.isNew = true;
            newObj.Activity = newAct;
            newObj.AuthorWorkflowPriv = oldACL.AuthorWorkflowPriv;
            newObj.RunWorkflowPriv = oldACL.RunWorkflowPriv;
            newObj.Permission = oldACL.Permission;
            newObj.PrivOwnerGroupPrincipal = oldACL.PrivOwnerGroupPrincipal;
            newObj.PrivOwnerUserPrincipal = oldACL.PrivOwnerUserPrincipal;
            return newObj;
        }
    }
}
